package com.wy.multilevelpulldown;

import android.content.Context;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {


    private ListPopuScreenMenuView listPopuScreenMenuView;

    private Context context;

    private List<String> tabList;

    private CommonMenuAdapter mCommonMenuAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        context = this;

        listPopuScreenMenuView = findViewById(R.id.listPopuScreenMenuView);

        tabList = new ArrayList<>();

        tabList.add("1");
        tabList.add("2");
        tabList.add("3");
        tabList.add("4");

        mCommonMenuAdapter = new CommonMenuAdapter(context, tabList);
        listPopuScreenMenuView.setAdapter(mCommonMenuAdapter);

        tabList.add("5");
        mCommonMenuAdapter.notifyDataSetChanged();

    }

    public int dp2Px(int dp) {
        float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }

}